package com.chinadci.smartcommunitysystembackstage.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chinadci.smartcommunitysystembackstage.entity.ScsOutsiders;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinadci.smartcommunitysystembackstage.mapper.ScsAdmintypeMapper;
import com.chinadci.smartcommunitysystembackstage.mapper.ScsOutsidersMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author Code Duck
 * @since 2021-04-13
 */
@Service
public class ScsOutsidersService{
    @Autowired
    private ScsOutsidersMapper mapper;

    private Logger log= LoggerFactory.getLogger(this.getClass());

    //显示所有外来临时人员
    public List<ScsOutsiders> Find(){
        log.info("=====显示所有外来临时人员");
        return mapper.selectList(null);
    }

    //根据姓名模糊查询显示所有外来临时人员
    public List<ScsOutsiders> Find(String name){
        log.info("=====根据姓名模糊查询显示所有外来临时人员");
        QueryWrapper<ScsOutsiders> qw=new QueryWrapper<>();
        qw.like("o_name","%"+name+"%");
        return mapper.selectList(qw);
    }
    //登记外来临时人员
    public int Insert(ScsOutsiders scs){
        log.info("=====登记外来临时人员");
        return mapper.insert(scs);
    }
}
